package org.dbrd.model;

import org.dbrd.Config;

public class DuplicateDetectionBugReport extends DetectionBugReport {

	private boolean detected;

	private MasterDetectionBugReport master;

	public MasterDetectionBugReport getMaster() {
		return master;
	}

	public void setMaster(MasterDetectionBugReport master) {
		if (master == null || master.getId() != this.getDuplicateId()) {
			throw new RuntimeException("master is null or this master is not the real master of this duplicate report.");
		}
		this.master = master;
	}

	public boolean isDetected() {
		return detected;
	}

	public void setDetected() {
		this.detected = true;
	}

	public DuplicateDetectionBugReport(int id, String originalSummary, String processedSummary, String originalDescription,
			String processedDescription, int duplicateId, final int priority, final String version, final String subComponent,
			final String issueType, String component) {
		super(id, originalSummary, processedSummary, originalDescription, processedDescription, duplicateId, priority, version,
				subComponent, issueType, component);
	}

	@Override
	public boolean isDuplicated() {
		if (Config.CHECKING) {
			if (!super.isDuplicated())
				throw new RuntimeException("cannot be non-duplicated for a duplicate bug report.");
		}
		return true;
	}

}
